import React from 'react';
import type { FormProps } from 'antd';
import { Button, Checkbox, Form, Input,Card } from 'antd';

type FieldType = {
  username?: string;
  password?: string;
  remember?: string;
};



const Login: React.FC = (props) => {
    const onFinish: FormProps<FieldType>['onFinish'] = (values) => {
        localStorage.setItem('token',values.username);
        props.history.push('/admin')
};

    return (
        <div>
    <Card style={{width:450,margin:"0 auto",textAlign: "center" }}>
  <Form onFinish={onFinish}>
    <Form.Item<FieldType>
      label="账号"
      rules={[{ required: true, message: '请输入!' }]}
    >
      <Input />
    </Form.Item>

    <Form.Item<FieldType>
      label="密码"
      rules={[{ required: true, message: '请输入!' }]}
    >
      <Input.Password />
    </Form.Item>


    <Form.Item label={null}>
      <Button type="primary" htmlType="submit">
        提交
      </Button>
    </Form.Item>
  </Form>
 </Card>        
        </div>
    )
}
 

export default Login;